package com.star.wellconnect;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;

public class WellConnectActivity extends BaseActivity {
	public static SharedPreferences mSharedPrefs;
	
	public WellConnectActivity() {
		super(R.string.app_name);
	}
	
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_wellconnect);
		mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
		
		ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
		WCFragmentPagerAdapter adapter = new WCFragmentPagerAdapter(
				getSupportFragmentManager(), 
				getResources().getStringArray(R.array.fragment_names));
		viewPager.setAdapter(adapter);
		
		viewPager.setOnPageChangeListener(new OnPageChangeListener(){
			@Override
			public void onPageScrollStateChanged(int arg0) { }
			
			@Override
			public void onPageScrolled(int arg0, float arg1, int arg2) {}
			
			@Override
			public void onPageSelected(int position) {
				if(position == 0){
					getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
				}else{
					getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
				}
			}
		});
		
		// Initialize
		viewPager.setCurrentItem(0);
		getActionBar().setDisplayHomeAsUpEnabled(false);
		getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	}
}
